<include file="public@header" />
</head>
<body>
	<div class="wrap">
        <form class="layui-form js-ajax-form" action="{:url('AdminIndex/addRecord')}">
            
            <div class="layui-form-item layui-form-text">
              <label class="layui-form-label" style="width: 100px;"><h4>新增记录</h4></label>
              <div class="layui-input-block">
                <textarea name="content" placeholder="请输入跟进情况描述" class="layui-textarea"></textarea>
              </div>
            </div>
            <div class="layui-form-item">
              <div class="layui-input-block">
                <input type="hidden" name="user_id" value="{$user_id}"/>
                <button class="layui-btn layui-btn-normal" lay-submit lay-filter="formDemo">提交</button>
              </div>
            </div>
          </form>
        <ul class="layui-timeline">
            <if condition="$records neq null">
                <foreach name="records" item="vo">
                    <li class="layui-timeline-item">
                        <i class="layui-icon layui-timeline-axis">&#xe63f;</i>
                        <div class="layui-timeline-content layui-text">
                          <h3 class="layui-timeline-title">{:date('Y年m月d日 H:i:s',$vo.update_time)}</h3><p>负责人：{$vo.record_manager} </p><br>
                          <p style="font-size: 20px;">
                            {$vo.content}
                            <a class="layui-btn  layui-btn-danger layui-btn-xs" href="javascript:editRecord({$vo['id']});">修改</a>
                          </p>
                        </div>
                      </li>
                </foreach>
                <else />
                <li class="layui-timeline-item">
                    <i class="layui-icon layui-timeline-axis">&#xe63f;</i>
                    <div class="layui-timeline-content layui-text">
                      <p style="font-size: 20px;">
                        暂无记录
                      </p>
                    </div>
                  </li>
            </if>
            
            
          </ul>
		<div class="pagination" style="margin-left: 35%;">{$page}</div>

    </div>
        <script src="__STATIC__/js/admin.js"></script>
        <script type="text/javascript">
            function editRecord(id,content){
                layui.use('layer', function(){
                  var layer = layui.layer;
                  
                  layer.prompt({title: '请输入修改内容', formType: 2}, function(text, index){
                    layer.close(index);
                    
                    $.get("{:url('AdminIndex/editRecord')}", 
                    {
                        id:id,
                        msg:text.replace(/\ +/g,"").replace(/[\r\n]/g,"")
                    }, function(res){
                      if(res.code==1){
                        layer.msg("修改成功")
                        setTimeout(function(){
                            window.location.reload();
                        },1000)
                      }
                    });
                  });
                }); 
            }
        </script>
</body>
</html>